import {InjectionToken, ModuleWithProviders, NgModule} from '@angular/core';
import {MessageRegister} from './message-register';

export const MESSAGE = new InjectionToken<MessageRegister>('MESSAGE');

@NgModule()
export class MessageRegisterModule {
  static forRoot(messageRegister: MessageRegister[]): ModuleWithProviders {
    return {
      ngModule: MessageRegisterModule,
      providers: [
        {provide: MESSAGE, useValue: messageRegister, multi: true}
      ]
    };
  }
}
